package hn.sigit.logic.general;


import java.util.MissingResourceException;

import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.core.SeamResourceBundle;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name("resBundle")
@Scope(value = ScopeType.CONVERSATION)
@AutoCreate
public class ResourceBundleHelperImpl implements ResourceBundleHelper {
	private SeamResourceBundle resourceBundle;
	
	public ResourceBundleHelperImpl() {
	}
	
	public String loadMessage(String str) {
		resourceBundle = (SeamResourceBundle)Component.getInstance("org.jboss.seam.core.resourceBundle");
		String retval = "";

		try {
			retval = resourceBundle.getString(str);
		}
		catch (MissingResourceException mre) {
			retval = str;
		}
		catch (NullPointerException npe) {
			retval = str;
		}
		
		return retval;
	}
}
